package it.truestoryfactory.tsq.game.util;

import java.util.ArrayList;
import java.util.Collections;

import android.graphics.Color;

public class TableIpColor {
	
	private Integer[] colors = null;
	private ArrayList<String> list;
	
	public TableIpColor() {
		colors = new Integer[6];
		colors[0] = Color.rgb(220, 20, 60); //crimson
		colors[1] = Color.BLUE;
		colors[2] = Color.rgb(50, 205, 50); //lime green
		colors[3] = Color.rgb(255, 165, 0); //orange
		colors[4] = Color.MAGENTA;
		colors[5] = Color.rgb(240, 230, 140); //khaki
	}

	public void setIpForColors(String myIp, TableMacIp tableMacIp) {
		list = new ArrayList<String>();
		list.add(myIp);
		for (int i = 0; i < tableMacIp.getDevicesNumber(); i++) {
			list.add(tableMacIp.getIpByIndex(i));
		}
		Collections.sort(list);
	}
	
	public int getColorByIp(String ip) {
		return colors[list.indexOf(ip)];
	}

}
